var resource = $('#inventorySourceValue2').val();
$('#inventorySourceValue2').change(function () {
    resource = $('#inventorySourceValue2').val();
})
function chuku(){

    $('#myModal2').modal('show');
    $('#myModalLabel2').html($('#chuku').text());
}
function chukusubmit(){
    var id = $('#idBox').text();
    if(id==null||id==undefined||id==""){
        alert("id不能为空");
        return;
    }
    var inventorySourceValue =$('#inventorySourceValue2').val();
    console.log($('#inventorySourceValue2').val());
    if(resource==null||resource==undefined||resource==""){
        alert("来源不能为空");
        return;
    }
    var changeNum = $('#num2').val();

    if(changeNum==undefined||changeNum==null||changeNum==""){
        alert("出库的数量不能为空");

        return;
    }
    var memo = $('#memo2').val();
    if(memo==null||memo==""||memo==undefined){
        alert("备注不能不填写");
        return;
    }
    $.ajax({
        url: '/crm/inventoryC/goodsOutput.json',

        data: {
            token: localStorage.getItem('crmtoken'),
            id:id,
            inventorySourceValue:resource,
            remark:memo,
            changeNum:changeNum
        },
        type: 'post',
        success: function (data) {

            if (data.code == -1) {
                window.parent.location.href = "/crm/login.jsp"
            }
            if (data.code == 0) {
                alert(data.msg);
            }
            if (data.code == 1) {
                $('#myModal2').modal('hide');
                alert("出库成功");
                window.location.href="/crm/inventoryC/detailsView?id="+id ;
                //getLogList();
            }
        }
    });


}